Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum


  

PreviousPrevious NextNext


~Zelda Reboosicheknivu 21.Oct.03 10:04 PM a Web browser
Domino Designer All Releases All Platforms


I am stuck with a bit of a conundrum... I need to come up with a random number between 1 and 6.

This function creates a random between 1 and 5, but just trying to get over the odd fractions seems weird...

l% = ((round(Fraction(Rnd),1) * 10) Mod 5) + 1

pretty much what this does is grab the first decimal value of the randomly generated number between 0 and 1 - multiplies it by 10 - giving me a number between 0 and 9 - performs a modulo on it so example:

case 0 ( 0 mod 5 = 0)
case 1 ( 1 mod 5 = 0)
case 2 ( 2 mod 5 = 0)
case 3 ( 3 mod 5 = 0)
case 4 ( 4 mod 5 = 0)
case 5 ( 5 mod 5 = 0)
case 6 ( 6 mod 5 = 1)
case 7 ( 7 mod 5 = 2)
case 8 ( 8 mod 5 = 3)
case 9 ( 9 mod 5 = 4)

Then adds 1 to come up with numbers between 1 and 5.

Some issues -
1. it is really difficult to get to six with this type of function.
2. I will end up with an inordinate amount of 0's (adjusted to 1 in the original function)

This seems like it should be simple... but it isn't kicking me that way...

It would be way easier if there was a function that set the lower and upper bounds of your result (like VB) such as:

num% = RND(lower value, uppervalue)
ie. num% = RND(1,6)

Any ideas out there?







How to create a random number betwe... (~Zelda Reboosic... 21.Oct.03)
. . i% = Int(Rnd(1) * 6)+1 (~Elizabeth Ekat... 22.Oct.03)
. . . . That will give a skewed result (WAS... (~Delores Dwonic... 22.Oct.03)
. . . . . . I guess you could you Randomize bef... (~Elizabeth Ekat... 22.Oct.03)
. . . . . . No, it is correct (WAS: That will g... (~Kirk Elreterod... 22.Oct.03)
. . . . . . . . Gah! Thanks Rod (~Dan Zekpone 23.Oct.03)
. . RE: How to create a random number b... (~Arnold Dwonuma... 21.Oct.03)
. . RE: How to create a random number b... (~Autumn Elfanac... 22.Oct.03)
. . . . . . RE: "The generation of random numbe... (~Kirk Elreterod... 22.Oct.03)





  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Category
Platform
Release
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS